<!-- 我的地图 -->

<template>
  <div class="DingdingSetting-MyMap full">
    <iframe :key="`${info.address}:${info.lon},${info.lat}`" :src="url" />
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

const PRE = 'https://m.amap.com/navi'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyMap',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixScreen()],

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    /**
     * 路径
     */
    url() {
      const { address, lon, lat } = this.info
      if (!lon || !lat) return `${PRE}/?hideRouteIcon=0&key=${process.env.GAODE_KEY}`
      return `${PRE}/?dest=${lon},${lat}&destName=${address}&hideRouteIcon=0&key=${process.env.GAODE_KEY}`
    },
  },
}
</script>

<style lang="scss">
@import './index.scss';
</style>
